std::basic_string::copy

From Cppreference

Jump to: navigation, search
​size_type copy( CharT* dest,

                size_type count,

                size_type pos = 0);

Copies a substring [pos, pos+count) to character string pointed to by s. If the requested substring lasts past the end of the string, or if ​count == npos​, the copied substring is [pos, size()). The resulting character string is not null-terminated.

If ​pos > size(), out_of_range is thrown.

Contents

Parameters

dest - pointer to the destination character string
pos - position of the first character to include
count - length of the substring

Return value

number of characters copied

Complexity

linear in count

Example

See also

substr
returns a substring
(public member function)
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
In other languages